package o;

import android.app.Notification;
import android.app.Notification.Builder;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
import android.os.Build.VERSION;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat.d;
import o.dky.j;

public class cei {
    public static void ˏ(Service service, int i, d dVar) {
        NotificationManager notificationManager = (NotificationManager) service.getSystemService("notification");
        if (notificationManager != null) {
            if (VERSION.SDK_INT >= 26) {
                NotificationChannel ˏ = ˏ(service);
                if (notificationManager.getNotificationChannel(ˏ.getId()) == null) {
                    notificationManager.createNotificationChannel(ˏ);
                }
                dVar.ˋ(ˏ.getId());
            }
            service.startForeground(i, dVar.ˊ());
        }
    }

    public static void ˋ(Context context, String str, int i, Builder builder) {
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null) {
            if (VERSION.SDK_INT >= 26) {
                NotificationChannel ˏ = ˏ(context);
                if (notificationManager.getNotificationChannel(ˏ.getId()) == null) {
                    notificationManager.createNotificationChannel(ˏ);
                }
                builder.setChannelId(ˏ.getId());
            }
            notificationManager.notify(ˎ(str), i, builder.build());
        }
    }

    public static void ॱ(Context context, String str, int i, d dVar) {
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null) {
            if (VERSION.SDK_INT >= 26) {
                NotificationChannel ˏ = ˏ(context);
                if (notificationManager.getNotificationChannel(ˏ.getId()) == null) {
                    notificationManager.createNotificationChannel(ˏ);
                }
                dVar.ˋ(ˏ.getId());
            }
            notificationManager.notify(ˎ(str), i, dVar.ˊ());
        }
    }

    @RequiresApi(api = 26)
    public static NotificationChannel ˏ(Context context) {
        return new NotificationChannel("notification.channel.default", context.getString(j.ᐝˊ), 3);
    }

    public static void ˏ(Context context, String str, int i, Notification notification) {
        if (VERSION.SDK_INT >= 24) {
            ˋ(context, str, i, Builder.recoverBuilder(context, notification));
            return;
        }
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null) {
            notificationManager.notify(ˎ(str), i, notification);
        }
    }

    public static void ˋ(Context context, String str, int i) {
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null) {
            notificationManager.cancel(ˎ(str), i);
        }
    }

    public static void ॱ(Context context) {
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null) {
            notificationManager.cancelAll();
        }
    }

    private static String ˎ(String str) {
        if (str == null) {
            return null;
        }
        return "Appgallery_" + str;
    }
}
